package mx.com.matersys.vacs.service;

import mx.com.matersys.vacs.domain.UserDetailsImpl;
import mx.com.matersys.vacs.domain.Usuarios;

import org.springframework.dao.DataAccessException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service("userDetailsService")
public class UserDetailsServiceImpl implements UserDetailsService {

	
	@Override
	public UserDetails loadUserByUsername(String username)
			throws UsernameNotFoundException, DataAccessException {
		
		UserDetailsImpl userImpl = new UserDetailsImpl(Usuarios.findUser(username));
		
		System.out.println(userImpl);
		
		return userImpl;
	}

}
